package com.hxk.controller;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * springboot整合文件上传下载
 * @author Cactus
 *
 */
@RestController
public class FileUploadController {

	@RequestMapping("/upload")
	public Map<String, Object> upload(MultipartFile file) throws IllegalStateException, IOException{
		Map<String, Object> rsMap = new HashMap<String, Object>();
		System.out.println(file.getOriginalFilename());
		file.transferTo(new File("e:/"+file.getOriginalFilename()));
		rsMap.put("msg", "ok");
		return rsMap;
	}
}
